#include <stdio.h> 
#include <stdlib.h>
#include <math.h> 
#include <mpi.h>
#include <omp.h>

int main(int argc, char *argv[])
{

    int nodeRank, numNodes, length; 
	char name[128];  
	MPI_Init(&argc,&argv);
	MPI_Comm_rank(MPI_COMM_WORLD,&nodeRank);
	MPI_Comm_size(MPI_COMM_WORLD,&numNodes);
	MPI_Get_processor_name(name, &length); 

	printf("nodeRank: %d\tnumNodes: %d\tProcName: %s\n", nodeRank, numNodes, name); 
	
	omp_set_dynamic(0); 
	omp_set_num_threads(8); 
	
	int threadRank, numThreads, numProcs;

	int i; 	
	#pragma omp parallel for private(threadRank, numThreads, numProcs) schedule(static, 1) 
	for(i=0; i<8; i++)
	{
		threadRank = omp_get_thread_num();
		numThreads = omp_get_num_threads();
		numProcs = omp_get_num_procs();
		
		printf("OMP: threadRank: %d\tnumThreads: %d\tnumProcs: %d\tnodeRank: %d\tnumNodes: %d\n", threadRank, numThreads, numProcs, nodeRank, numNodes); 
	}

 
	
	    

	MPI_Finalize();    
    return 0; 
}
    
